Accessibility
Home / DevNet / Dreamweaver Development Center /
DevNet
Dreamweaver Article
Heidi Bautista

Heidi Bautista
Groovy bits

 
Implementing Forms-Based Authentication


User authentication is one of the most common tasks a web programmer needs to perform. Any website with a login form must implement some form of authentication.

This article describes how to develop a customized user authentication module based on ASP.NET forms authentication. Along the way you'll learn how to use the Macromedia custom DataSet tag in Dreamweaver MX to access and use login credentials stored in a database. First, you'll build a relatively simple authentication system; then, you'll construct a more comprehensive system.

In a typical scenario, you would want to limit access to pages in a restricted directory to users who have logged in. If a user requests a protected page before he or she logs in, the page should redirect the user automatically to a login page; likewise, when a user successfully logs in, the page should redirect him/her to the the previously requested page, within the restricted directory.

For example, a user who has not yet logged in (or a logged-out user) attempts to access a page in the protected members folder:

http://security/members/MemberOnlyFile.aspx

A page with forms authentication automatically redirects the user to the login page in the root folder:

http://security/login.aspx?ReturnUrl=%2fmembers%2fMemberOnlyFile.aspx

Finally, the user logs in with the appropriate credentials and the page automatically redirects him/her back to the originally requested page.

For this article, I used Dreamweaver MX 6.1 to create ASP.NET pages written in C#, and Microsoft IIS 5.0 to serve the pages. The SQL Server 2000 database contains two tables, called "members" and "manager":

Tables in the SQL Server 2000 database
 

Download the Code

download  forms_authentication.zip (61K)

Table of Contents

  Next
--------------------------------------------------------------------------------

About the author
Heidi Bautista designs dynamic back ends for commercial websites. Her firm, Groovy bits, teams up with front-end design shops to create compelling, yet highly functional, Internet portals for banks, investment firms, online stores, art galleries, and other businesses. Heidi typically chooses ASP.NET as her web technology and Dreamweaver MX as her authoring environment. When she's not chained to her keyboard, Heidi races Hawaiian-style outrigger canoes. You can reach her at bautista@groovybits.com.